Skip to content

fix(cli)!: secret rewrap --apply without --yes in a non-interactive shell exits 1 - #38042

Draft
objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/project-thread-loz2y0
Draft

objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/project-thread-loz2y0

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #36679
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no file under skills/** mentions os secret rewrap (grep rewrap over skills/: 0 hits); the CLI reference section content/docs/deployment/cli.mdx § os secret rewrap was re-read and says nothing about the exit status of an unconfirmed run, so nothing it states is falsified

维护者速读

  • 运维在脚本、CI 或定时任务里运行密钥重新封装命令并要求写入、但没加确认参数时,以前显示「已中止」并返回成功,现在返回失败并提示加确认参数;交互式回答「否」照旧返回成功。
  • 为什么做:与数据库迁移命令和两个孤儿清理命令已定的规则对齐,避免脚本把什么都没重新封装的一次运行当成密钥轮换完成。
  • 出错会怎样:只改未确认时的退出码与提示文字,读取、重新封装和写入的内容都不变;依赖旧退出码的脚本需加确认参数,出问题可直接撤回本改动。
  • 要你做什么:无。

Breaking

BREAKING (an exit status narrows), shipped as patch: the change is not to the metadata protocol (Metadata-protocol: none), so the level axis grades patch, as the precedent #36676 did for the orphans commands.

  • FROM: os secret rewrap --apply on a database with a version-1 sys_secret row to re-wrap, without --yes, stdin not a terminal, text face: nothing opened or written, Aborted — no row was opened or written., exit 0.
  • TO: nothing opened or written, Confirmation required. Re-run with --yes to re-wrap. No row was opened or written., exit 1.
  • Unchanged: answering n at the [y/N] prompt in a terminal still prints Aborted — … and exits 0; --json without --yes already exited 1 with confirmation_required; --yes re-wraps as before; a dry run, or an --apply run with nothing to re-wrap, asks nothing and keeps the exit status it had (0 when the run is not otherwise refused; a missing data key or an incomplete reference union still exits 1).
  • The fix for a script: pass --yes to re-wrap; drop --apply to get only the dry-run report.

ADR-0087 disposition: the changeset carries the marker adr-0087: not-required (no-migration-prescription); no metadata, stored shape or export moves. node scripts/check-adr-0087-registration.mjs --base origin/main at b15bd75 (the marker is unchanged at 00049e7): 1 declared-breaking changeset(s), each carrying an ADR-0087 disposition ([BREAKING+bang+clause-②-narrowing]).

What changes

os secret rewrap --apply, run where stdin is not a terminal and without --yes, now prints a warning naming --yes and exits 1. The shape is the one os db orphans / os secret orphans took in #36676 (and the os migrate family's): inside the !flags.yes gate, after the --json face, a non-TTY branch warns and calls this.exit(1). The this.exit(1) sits inside the try whose catch already rethrows the exit signal (isExitSignal) and whose finally shuts the stack down. Nothing about what rewrap opens, re-seals or writes changes.

The confirmation pin packages/cli/test/orphans-confirmation-exit.pin.test.ts widens its population from "non-migrate commands declaring boolean delete and yes" to "non-migrate commands declaring a boolean yes", whatever mode flag it confirms. Today that is db orphans, secret orphans and secret rewrap. The walk that feeds it now descends the whole of src/commands minus migrate/ (top-level commands such as os deploy and subcommands two levels down such as os plugin trust revoke included), as the migrate pin's walk does, and decides membership off the loaded class's flags only: no source-text prefilter, so a quoted 'yes' key or a flag from a shared flag set counts. A census case holds the list of loaded modules equal to an independent recursive listing of the same tree, so a walk that stops descending fails on its own; a second names today's three members. The next command with a --yes outside src/commands/migrate fails the population case until it has a roster row. Per ruling record 6583487846 the row goes into the existing harness file, not a new one. The rewrap row runs the real reference union, planner, executor and local crypto provider (over OS_SECRET_KEY) on a fake engine holding one version-1 row its setting references; only the boot is replaced.

Read first, by risk:

  1. packages/cli/src/commands/secret/rewrap.ts — the new non-TTY branch inside the !flags.yes gate.
  2. packages/cli/test/orphans-confirmation-exit.pin.test.ts — the recursive walk and its census, the widened population, the one-shot-settings mock now keeping the real oneShotCrypto, and the rewrap fixture.

Two-minute check: pnpm --filter @objectstack/cli exec vitest run --project unit test/orphans-confirmation-exit.pin.test.ts — expect 15 passed.

Tests

Per roster member (3): text face non-TTY without --yes (exit 1, output names --yes, nothing written, no export, no prompt); --json face (exit 1, confirmation_required); control --yes (exit 0, one write, export written where the mode writes one); control terminal answered n (prompted, exit 0, nothing written). Plus three population cases: the walk census (loaded modules == a recursive listing of src/commands minus migrate/), population == roster, and today's census. 15 tests.

Premise probe on origin/main 3e8edf7 (before the fix)

A probe driving the real command (boot replaced only):

PROBE tty=false exit=0 writes=0 lines=["  ℹ Aborted — no row was opened or written."]
PROBE tty=true exit=0 writes=0 lines=["  ℹ Aborted — no row was opened or written."]
Pin run at 00049e7
 Test Files  1 passed (1)
      Tests  15 passed (15)
os-verify-lock: VERDICT command-exit 0
Ablations at 00049e7, each through scripts/ablation-replace.mjs and restored (blob == HEAD, git diff HEAD empty)

A1, the non-TTY this.exit(1) in rewrap.ts removed (blob 104d5a39 -> d90df941):

     × secret rewrap — text face: exit 1, names --yes
      Tests  1 failed | 14 passed (15)

A2, the walk stopped below one directory (pin blob 3f67d892 -> 033acfbf):

     × the walk loaded every command module outside migrate, at every depth
-   "plugin/trust/add.ts",
-   "plugin/trust/list.ts",
-   "plugin/trust/revoke.ts",
      Tests  1 failed | 14 passed (15)

A3, a quoted 'yes' boolean planted on the top-level os deploy (blob 953b5a1d -> b97875fa):

     × is exactly the roster — a new member names how its gate is reached before it can pass
     × the census today: three commands outside migrate declare --yes
      Tests  2 failed | 13 passed (15)

A4, a yes boolean planted on os plugin trust revoke, two directories down (blob a13e4d32 -> 03dc13f5): the same two cases red, 2 failed | 13 passed (15).

Two earlier attempts (A1 at 824d759, A2 at 00049e7) were refused by the tool as no-ops because the replacement text contained the anchor; nothing ran on either, and each was redone with a disjoint replacement.

Acceptance notes

Verification

Local runs are listed with their head in the os-dev report on #36679; CI's check-runs on this PR are the record for every family CI runs.


Generated by Claude Code

…hell exits 1

A run that did not get its confirmation opens and writes nothing and exits 1,
naming --yes, as the os migrate family and the orphans commands do. An
interactive "n" keeps exit 0; the --json face is unchanged.

The orphans confirmation pin's population widens to every non-migrate command
declaring a boolean --yes, with a roster row for secret rewrap.

Claude-Session: https://claude.ai/code/session_01L9qibwZirQyEPMnAGdpGGW
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/cli, touching 2 documentable anchor(s).

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/deployment/cli.mdx (via os secret rewrap (command, read off packages/cli/src/commands/secret/rewrap.ts))

⛔ 1 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-7.mdx (via os secret rewrap (command, read off packages/cli/src/commands/secret/rewrap.ts))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see

Coarse fallback — 40 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 8d34c4404f951410083a6caebd6ad8003ea3423d → packageMentionDocs.

Which tree this was computed on

This run read content/docs from cf1ed2590c214c19823b8faaf94aab52586e2efb — the merge of head 00049e7be83628c9540f1bc3380d941a8e4c3873 into base 8d34c4404f951410083a6caebd6ad8003ea3423d, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin cf1ed2590c214c19823b8faaf94aab52586e2efb && git checkout cf1ed2590c214c19823b8faaf94aab52586e2efb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8d34c4404f951410083a6caebd6ad8003ea3423d 00049e7be83628c9540f1bc3380d941a8e4c3873 && git checkout -B drift-repro 8d34c4404f951410083a6caebd6ad8003ea3423d && git merge --no-ff 00049e7be83628c9540f1bc3380d941a8e4c3873

node scripts/docs-audit/affected-docs.mjs --json 8d34c4404f951410083a6caebd6ad8003ea3423d

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 8d34c4404f951410083a6caebd6ad8003ea3423d → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1

Contract-review-claim: session_01L9qibwSEecrzDjKjbk24r1 · head b15bd75 · 2026-11-27T20:57Z

L1-a (the seat's L1 thread) runs the isolated CONTRACT_REVIEW_TIER review on this head (narrowing face: os secret rewrap --apply without --yes in a non-interactive shell now exits 1), and posts its L1 beside it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: b15bd751db812bb43a40019fdee822bc77d71ec2
Local-runs: none
Scope: packages/cli/src/commands/secret/rewrap.ts, packages/cli/test/orphans-confirmation-exit.pin.test.ts + read in the cited code, not reviewed: packages/cli/src/commands/db/orphans.ts and packages/cli/src/commands/secret/orphans.ts (the --yes gate and confirm()), packages/cli/src/commands/migrate/** (every isTTY gate), packages/cli/test/migrate-confirmation-exit.pin.test.ts (its population walk), packages/cli/src/utils/sys-secret-rewrap.ts (planSysSecretRewrap, refusal, attempts), packages/cli/src/utils/one-shot-settings.ts, packages/cli/src/commands/secret/rewrap.guards.test.ts, packages/cli/src/utils/schema-migrate.one-shot-family.integration.test.ts, the layout of packages/cli/src/commands/**, scripts/check-changeset-no-major.mjs, .changeset/pre.json, .changeset/config.json, AGENTS.md (the changeset rule), content/docs/deployment/cli.mdx § os secret rewrap

Read on this head: the net diff against main at 3e8edf78c2d16738a7740bcd68e33158d96691a5 (3 files, +187/-51), card #36679 with its three comments (triage 7099072147, claim 7226704095, os-dev report 7227989647; no ruling among them), the PR body and its two comments, PR #36676 with its changeset and both contract-review records (7111408857, 7112313456), and the check-runs on this head: 37 success, 16 skipped, 0 failed, 0 pending. The skipped runs are the path-filtered UI and docs jobs and the opt-in jobs.

① Derived judgments

  • Accept set: no change. No flag, argument, value or --json key is added, removed or re-typed. Clause-②: no is right.
  • Public surface, exit status: one narrowing. os secret rewrap --apply, without --yes, text face, process.stdin.isTTY falsy, with a plan of one or more attempts: exit 0 becomes exit 1. The new branch sits inside the existing gate (flags.apply, a plan with attempts, and no flags.yes), after the --json branch and before confirm(). Declared (narrowing): right.
  • Public surface, printed line: on that path Aborted — no row was opened or written. (info) becomes Confirmation required. Re-run with --yes to re-wrap. No row was opened or written. (warning), each followed by the journal-mode note on a SQLite file. Right, and true: the branch exits before executeSysSecretRewrap, so no row is opened or written.
  • The exit fires in that one case and no other. Each read in the tree:
    • a terminal answered n: confirm() returns false, Aborted — …, plain return, exit 0. Unchanged.
    • --json without --yes: confirmation_required, exit 1, the same bytes as on main. Unchanged.
    • a dry run (no --apply): the gate's first conjunct is false. Unchanged.
    • --yes: the gate is skipped whole. Unchanged.
    • --apply with zero attempts: the gate is skipped, no prompt. Unchanged.
    • stdin a pipe, a closed pipe or /dev/null: isTTY is undefined, so exit 1. On main each of these already refused (confirm() returned false before it read anything), so a piped y never confirmed; only the status moves.
    • CI detection: none. The test is process.stdin.isTTY alone, with no CI variable read. A job that allocates a pseudo-terminal is prompted, as on main and as in every sibling.
  • The refusals that come before the gate (unreadable declared datasources, crypto provider, boot, union incomplete, no compare-and-set writer, no key) are untouched and still exit 1 first.
  • this.exit(1) is thrown inside the try whose catch rethrows on isExitSignal and whose finally shuts the stack down, so the exit is not rewritten to scan_failed and the stack is closed.
  • Against fix(cli)!: orphans --delete without --yes in a non-interactive shell exits 1 #36676, line for line: db/orphans.ts and secret/orphans.ts carry the same three steps in the same order (--json emits and returns; !process.stdin.isTTY warns and this.exit(1); the prompt's decline prints Aborted — … and returns), with the same confirm() body. The three now behave identically at the gate. Two differences remain and both are the commands' own shape, not drift: rewrap's gate also tests flags.apply and a non-zero plan.attempts because its default mode is a dry run that reaches the same code, where the orphans commands return before the gate; and rewrap prints no "About to …" line before the refusal.

② Semver level

  • '@objectstack/cli': patch with Metadata-protocol: none: right. No spec key, authorable value or stored shape moves. AGENTS.md on this head: "none takes patch; a non-protocol change, widening or breaking, ships patch and keeps its BREAKING banner and ADR-0087 disposition". .changeset/pre.json is in pre mode (tag next), and @objectstack/cli is in the fixed group of .changeset/config.json, so the level is the group's and a patch entry raises nothing. This is the level fix(cli)!: orphans --delete without --yes in a non-interactive shell exits 1 #36676 shipped. Check Changeset: success.
  • Clause-②: no (narrowing): right, and present on both the PR body and the changeset. Title and changeset headline carry !. The banner carries FROM / TO / Unchanged / the fix for a script.
  • adr-0087: not-required (no-migration-prescription): right. Nothing exists for objectstack migrate meta to rewrite; the remedy is a flag on the caller's command line. Lint · CI, release & engine gates and Lint & Repo Gates: success.
  • The changeset prose against the code: the headline, FROM, TO, the terminal-n clause, the --json clause, the --yes clause, the script remedy and the closing sentence about the os migrate and orphans commands each hold. One clause is loose, see the nit in ④.

③ Boundary flags

  • open_questions: empty in the os-dev report. Nothing to answer.
  • Dev flag, content/docs/deployment/cli.mdx § os secret rewrap left as is: accepted. The section lists -y, --yes — skip the confirmation prompt and states no exit status for an unconfirmed run, so nothing in it is falsified.
  • Skills-docs: none: true. No file under skills/ names rewrap.
  • In-repo callers: none relies on the old status. Every --apply run of the command in tests passes --yes (rewrap.guards.test.ts, rewrap.driver-contract.test.ts, schema-migrate.one-shot-family.integration.test.ts), except the two that mean not to: the --json refusal case and the decline case, which sets a terminal. No workflow under .github and no script under scripts/ runs the command.
  • File surface against claim 7226704095: exactly the three claimed paths.
  • Dogfood battery owed by the (narrowing) arm: the dev reports a full run at this head with no failure. That is the dev's reading, not re-run here. Dogfood Regression Gate on this head: success.
  • SQL push-down: no new query, id materialisation or in-app join. The source hunk adds one branch on process.stdin.isTTY; the pin runs on fakes.

④ Design judgment

No must-fix.

  • The narrowing takes no declared capability away. Nothing on main declares exit 0 for an unconfirmed --apply: the --yes flag text says it skips the prompt, the --json flag text says applying "requires --yes", and cli.mdx is silent on the status. The refusal was already real (nothing opened, nothing written); the status and the line now report it. What a script loses is reading a no-op as a key rotation, which is the defect the card names. Both remedies work on this head: --yes re-wraps, and dropping --apply gives the dry-run report.
  • Tried to break it, and it held: (a) a non-interactive run cannot reach the prompt or the executor; (b) the exit signal is not swallowed; (c) the pin's text-face case cannot pass on some other exit 1, because the earlier refusals do not print --yes and the --yes control, on the same fixture and argv, exits 0 with exactly one write, which needs the real planner to attribute the row and the real local provider to open, re-seal and verify it; (d) the pin sets process.stdin.isTTY per run and restores it, and saves and restores the key environment; (e) the existing decline case in rewrap.guards.test.ts runs on a terminal, so it does not contradict the change.
  • The rewrap row runs what the header says it runs. secret-reference-union.js is mocked to a seam that the fixture points back at the real function; sys-secret-rewrap.js (planner, executor) and oneShotCrypto are not mocked; the boot is replaced and the fixture drives the host crypto seam by hand. The ablation reading fits the code: without the new this.exit(1) a non-terminal run falls through to confirm(), which answers false, so the run prints Aborted — … and exits 0, and only the rewrap text-face case goes red. Test Core 10/10: success.
  • Migrate's exclusion is justified: migrate-confirmation-exit.pin.test.ts owns src/commands/migrate/** with its own population, which includes the one member confirmed by --backup-taken, so a single yes-keyed population could not hold it.
  • S1 (should-fix) — the population is derived, but over a walk that does not reach every command, so the claim the PR makes for it is not true. The roster equality is read off the classes' flags, which is right. The walk feeding it reads only modules exactly one directory below src/commands, and imports only a module whose source matches the text yes: Flags.boolean. On this head that reaches 47 of the 71 command modules outside migrate. The 21 top-level modules (deploy.ts among them, the one that already prompts) and the 3 under plugin/trust/ are not read, and a flag spelled with a quoted key or taken from a shared flag set is not imported. A --yes added to any of those joins no population and no pin fails. The header ("every command outside os migrate", "the next such command fails here"), the PR body and the card's third done-when ("caught by construction") all state more than that. The fix(cli)!: orphans --delete without --yes in a non-interactive shell exits 1 #36676 record 7111408857 recorded this reach as a nit and folded its fix into this card; this PR widens the flag predicate and leaves the reach as it was, without naming it as a deviation. The sibling migrate pin already descends ("the walk descends"). No escaped command exists today, so product behaviour is not wrong; the pin's stated guarantee is. The fix is in the pin file: walk src/commands recursively minus migrate, top level included, as the migrate pin does. It moves the head and earns a delta review.
  • nit — the changeset's Unchanged clause "a dry run, or an --apply run with nothing to re-wrap, exits 0 without asking" is unconditional where the code is not. A dry run with a row to open and no data key exits 1, and an --apply run whose reference union is incomplete exits 1 (union_incomplete) with zero attempts. Neither path is touched by this PR, so "unchanged" holds; "exits 0" holds only for a run that is not otherwise refused. The PR body repeats it. Fixable on the prose face, or left as an accepted deviation; fix(cli)!: orphans --delete without --yes in a non-interactive shell exits 1 #36676 worded its clause the same way.
  • nit — cli.mdx § os secret rewrap could state the refusal the way one os migrate entry on that page does ("without it, a run whose stdin is not a terminal (or --json) … exits 1"). Nothing there is false. A follow-up for the three commands together, not this PR.

Implemented-by: claude/project-thread-loz2y0
Reviewed-by: session_01L9qibwSEecrzDjKjbk24r1

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1

The filled brief the record above was rendered from (L1-a, isolated CONTRACT_REVIEW_TIER subagent):

Contract review brief — PR #38042 @ b15bd751db812bb43a40019fdee822bc77d71ec2 (card #36679)

You review at CONTRACT_REVIEW_TIER. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template --face narrowing — with a PASS or FAIL verdict, and post it as ONE comment
on the PR or its card.

Inputs — these and nothing else:
· card #36679: its body and EVERY comment (rulings and earlier records included)
· PR #38042: its body, its file list, and the net diff against main at 3e8edf78c2d16738a7740bcd68e33158d96691a5
· the check-runs on b15bd751db812bb43a40019fdee822bc77d71ec2: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — the narrowing is declared of the whole PR, never of a path: the floor is EVERY path of the diff outside the
prose faces (content/docs/**, .changeset/**), plus every file those hunks make a claim about, read in the cited code.
Widen it freely, ⛔ never below that floor; the record's Scope: line lists both. No path is the lane seat's remainder.
④ judges the narrowing itself over that floor: lockfiles, generated output, changesets and prose elsewhere in
the PR are not reviewed; the published spec and the cited code are READ to judge it, never reviewed.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/166e2125-4268-552f-a555-2b7c43a99f0f/scratchpad/pr-38042/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
④ Design judgment — the narrowing itself, read against the published spec on main: does it take a
declared capability away at the consumer, or make the spec's own refusal real? A capability declared
and not delivered is an implementation gap, implemented or retired, ⛔ never narrowed at the consumer.
Read the spec and the cited code in the live tree, and try to break the design.
Grade each finding must-fix, should-fix or nit — a nit has no effect on correctness or the contract.
A must-fix is a FAIL; a must-fix or should-fix earns a delta review of its fix; nits alone end the round.
Spell a must-fix or should-fix with its id and grade, S1 (should-fix) — …, and a clean round as
No must-fix, no should-fix.: the queue guard reads a graded finding as OPEN on this head and
refuses the record; the delta record names those it closes by id alone, S1: closed.
A nit is fixed only on the prose faces, or left as an accepted deviation or a follow-up card: a fix
anywhere else moves the head, and this record no longer covers it.
⛔ Judge the tree, never the PR body's account of it.
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.

The population walk read only modules one directory below src/commands and
pre-filtered on the source text, so a top-level command (os deploy) or a
subcommand two levels down could gain a --yes with no pin failing. It now
descends the whole tree minus migrate, as the migrate pin does, and decides
membership off the loaded class's flags alone.

The changeset's Unchanged clause now says a dry run keeps the exit status it
had, rather than that it exits 0 unconditionally.

Claude-Session: https://claude.ai/code/session_01L9qibwZirQyEPMnAGdpGGW
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-27T21:04Z

L1 REWORK at b15bd751db812bb43a40019fdee822bc77d71ec2 (L1-a for the seat). The isolated CONTRACT_REVIEW_TIER record 7228083567 is a PASS (claim 7228016842, filled brief 7228097597, verify-review-tier PASS). It has no must-fix and one should-fix, which owes a delta of its fix.

What holds:

  • The exit path is exact. Exit 1 fires only for --apply with attempts, no --yes, the text face, and a stdin that is not a TTY. A TTY "n" stays 0, --json keeps confirmation_required and exit 1 as on main, and a dry run, --yes and a zero-attempt --apply skip the gate. It matches db/orphans.ts and secret/orphans.ts step for step, apart from rewrap's own apply/attempts test.
  • The narrowing makes the refusal real and takes no capability away. The --json flag text already says applying "requires --yes". Skills-docs: none is true. No in-repo caller runs --apply without --yes non-interactively.
  • The rewrap row runs the real union, planner, executor and local crypto. The --yes control and the ablation reading fit the code.
  • The level (patch with the BREAKING banner, in pre-mode within the fixed group) and the no-migration-prescription marker are right, as for fix(cli)!: orphans --delete without --yes in a non-interactive shell exits 1 #36676.
  • The face: CI is 37 success, 16 expected skip, 0 failed. The dogfood battery is pinned to b15bd751 in report 7227989647 (4144 passed, 0 failed).

Owed before ACCEPT.

  • S1 (should-fix): the pin population does not reach every command, so "caught by construction" (the card's third done-when) is not yet true.
    • The walk reads only modules exactly one directory below src/commands: 47 of the 71 non-migrate modules. The 21 top-level modules (including deploy.ts, which already prompts) and the 3 under plugin/trust/ are never read.
    • It imports only modules whose source matches the text yes: Flags.boolean, so a quoted key or a shared flag set escapes.
    • The fix(cli)!: orphans --delete without --yes in a non-interactive shell exits 1 #36676 record (7111408857) logged this reach as a nit and folded its fix into this card. This PR leaves it unaddressed and does not name it as a deviation.
    • No command escapes today, so this is a should-fix and not a must-fix.
    • Fix: walk src/commands recursively, as migrate-confirmation-exit.pin.test.ts already does. Decide membership from the loaded class's flags rather than a source-text match, or keep the text prefilter and add a census assertion that counts what was walked.
    • The fix moves the head. It owes a same-reviewer delta and a dogfood reading pinned to the new head.

Nits (not blocking).

  • N1: the changeset's and the body's Unchanged clause, "a dry run, or an --apply run with nothing to re-wrap, exits 0 without asking", is stated without conditions, but the code has them. A dry run with a row to open and no key exits 1, and so does --apply with an incomplete union and zero attempts. Those paths are untouched. Scope the sentence in the same push if you like.
  • N2: cli.mdx § os secret rewrap could state the exit-1 refusal, as one os migrate entry on that page does. Nothing there is false. This is a follow-up for all three commands.

Tier H on landing (narrowing).

The walk records every module it loads; a case holds that list equal to an
independent recursive listing of src/commands minus migrate/, so a walk that
stops descending, or skips the top level, fails on its own even while the
three members it does reach still equal the roster. A second case names
today's census: db orphans, secret orphans, secret rewrap.

Claude-Session: https://claude.ai/code/session_01L9qibwZirQyEPMnAGdpGGW
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1

Contract-review-claim: session_01L9qibwSEecrzDjKjbk24r1 · head 00049e7 · 2026-11-27T21:52Z

L1-a runs the same reviewer's delta of record 7228083567 on this head (S1: the pin walk's reach), with its L1 beside it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 00049e7be83628c9540f1bc3380d941a8e4c3873
Local-runs: none
Scope: packages/cli/src/commands/secret/rewrap.ts, packages/cli/test/orphans-confirmation-exit.pin.test.ts + read in the cited code, not reviewed: the layout of packages/cli/src/commands/** (every module path, extension and default export), packages/cli/package.json (the oclif.commands pattern), packages/cli/src/commands/build.ts and compile.ts (an inherited flag set), packages/cli/src/utils/sys-secret-rewrap.ts (refusal, attempts), packages/cli/test/migrate-confirmation-exit.pin.test.ts

Delta record over the PASS at b15bd751db812bb43a40019fdee822bc77d71ec2 (comment 7228083567), which left S1 open. The head moved by two commits (47487d3a, 00049e7b). Read: git diff between the two heads (2 files, +46/-20: the pin and the changeset), the pin in full at this head, the os-dev report 7228826855 on card #36679, and the check-runs on this head: 39 success, 18 skipped, 0 failed, 0 pending. Nothing under packages/cli/src moved, so rewrap.ts is the blob the earlier record read.

S1: closed

① Derived judgments

Unchanged from the record at b15bd751. The accept set does not move. The one narrowing is the exit status 0 to 1 on the text face of os secret rewrap --apply, without --yes, with stdin not a terminal and a plan with attempts. Every Unchanged case was derived from a source blob that did not move.

② Semver level

Unchanged and right: '@objectstack/cli': patch, Clause-②: no (narrowing), Metadata-protocol: none, and the adr-0087: not-required (no-migration-prescription) marker. One changeset sentence moved, see ④. Check Changeset: success on this head.

③ Boundary flags

  • open_questions: empty in report 7228826855.
  • Dev flag, the cli.mdx nit left to the seat with a concrete edit for the three option lines: accepted as a follow-up. Nothing on the page is false on this head.
  • Dev flag, the cli unit layer and the typecheck not re-run locally because no source moved: answered by the head's check-runs. Test Core 10/10, TypeScript Type Check and Lint & Repo Gates are success.
  • Dogfood battery: the dev reports a full run at this head with no failure. That is the dev's reading, not re-run here. Dogfood Regression Gate: success.
  • SQL push-down: nothing new. The delta is a test's directory walk and one sentence of prose.

④ Design judgment

No must-fix, no should-fix.

  • The walk now reaches every command module outside migrate. collect() recurses from src/commands and skips one thing, the directory named migrate at the top level. It imports every .ts file that is not a test, spec or declaration file, with no source-text prefilter. Against the tree: every one of the 121 files under src/commands is a .ts file, the 71 non-migrate command modules sit at depth 0 (21), 1 (47) and 2 (3), and package.json loads commands from dist/commands alone by pattern, so no command lives anywhere else. A topic's index.ts is read like any module and keyed by its topic.
  • The census case is not vacuous. Its right-hand side is a separate traversal (readdirSync with recursive), so a walk that stops short fails it, which is the dev's ablation A2. It also names deploy.ts and plugin/trust/revoke.ts, so an empty or shallow listing on both sides cannot pass. The two sides do share one filter, the .ts extension with the test and declaration exclusions; see the nit.
  • Membership reads the loaded class. cls.flags?.yes?.type === 'boolean' reads the static flags object, so a quoted key and a spread shared flag set count, and a subclass that declares no flags of its own reads its parent's through the static chain (build.ts extends Compile). The dev's ablations A3 and A4 fit the code: a boolean yes on deploy.ts or on plugin/trust/revoke.ts joins the population, and both the roster case and the three-name census case go red.
  • The changeset's Unchanged sentence is now true against rewrap.ts. A dry run or a zero-attempt --apply skips the gate, so neither asks. Each keeps its status: a dry run with a row to open and no data key exits 1, and --apply with an incomplete union exits 1 before the gate. The first nit of the earlier record is fixed.
  • nit — two declarations of a --yes would still not join the population: one made through oclif's static baseFlags, which parse merges and cls.flags does not hold, and one under another flag name carrying yes as an alias. No command in the CLI uses either today. The header says "declare a boolean yes flag", which stays true of what is read. Left as an accepted deviation; a fix would move the head.
  • nit — the walk and the census both read .ts files only. A command written as .tsx or .mts would be missed by both sides at once. None exists, and every command module is .ts. Accepted deviation.
  • nit — cli.mdx § os secret rewrap still states no exit status for an unconfirmed run. Carried from the earlier record as a follow-up for the three commands together.

Implemented-by: claude/project-thread-loz2y0
Reviewed-by: session_01L9qibwSEecrzDjKjbk24r1

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-27T21:56Z

L1 ACCEPT at 00049e7be83628c9540f1bc3380d941a8e4c3873 (L1-a for the seat), answering L1 REWORK 7228108944. Tier H (a narrowing, fix(cli)!), so it goes to the seat's hand-off for the maintainer.

Contract review. Record 7228083567 on b15bd751, and the same reviewer's delta 7228877674 on this head (claim 7228847662): PASS, S1: closed, no must-fix, no should-fix. verify-review-tier PASS on each transcript.

  • The delta is 2 files, the pin and the changeset. Nothing under packages/cli/src moved, so the record's reading of the exit path stands.
  • S1 closed. The walk recurses through all of src/commands, skipping only migrate/. All 71 non-migrate modules are reached, at depths 0, 1 and 2. Membership is read from the loaded class (cls.flags?.yes?.type === 'boolean'), which covers quoted keys, spread flag sets and inherited flags. The census compares against a separate recursive readdirSync, so it cannot pass vacuously. The reported ablations A2 to A4 fit the code.
  • N1 closed. The changeset's Unchanged sentence now holds against rewrap.ts: exit 0 when nothing else refuses, and still 1 for a missing key or an incomplete union.

Face. l1-face: CI at this head is 39 success, 18 expected skip, 0 failed, 0 pending, and mergeable_state is clean. The dogfood battery is pinned to this head in report 7228826855 (os-verify-lock VERDICT 0, 490 files and 4144 tests passed, 0 failed).

Nits (accepted deviations or follow-ups, not blocking).

  • A --yes declared through oclif baseFlags, or as an alias, would not join the population. None exists today.
  • The walk and the census share a .ts-only filter. No .tsx or .mts command exists.
  • N2: cli.mdx should state the exit-1 refusal for the three commands. The seat is filing a card.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Recorded 2026-11-27T21:57Z.

席位意见:可以合。pin 现在递归扫描 src/commands(migrate 除外),共 71 个模块,凡是声明了布尔 yes 的命令都要求非终端运行时退出 1,以后新加的命令也会被这条 pin 拦住。

席位核对 — ACCEPT · repo:objectstack#3 · head 00049e7be83628c9540f1bc3380d941a8e4c3873

  1. 形态:Fixes #36679;Clause-②: no (narrowing)、Metadata-protocol: none;changeset 为 @objectstack/cli patch,带 BREAKING 标注和 ADR-0087 not-required(no-migration-prescription);3 个文件。
  2. 前提实测:在 origin/main 3e8edf7 上用探针驱动真实命令(真实的 planner、executor 和 LocalCryptoProvider):非终端、不加 --yes 时退出 0,0 次写入(认领 7226704095)。修复后,消融四项都转红,分别是 rewrap 的 exit(1)、只扫一层、顶层 deploy.ts 带引号的 yes、plugin/trust/revoke.ts 的 yes,之后都已还原。
  3. 门禁 check-runs:39 success、18 预期跳过、0 失败,mergeable_state clean。check-governed-merges --pr 38042:0/3 路径命中;收窄 ⇒ Tier H。landing-k:K = 1,少于 15。dogfood 在本 head 上:490 个文件、4144 个测试,0 失败(报告 7228826855)。
  4. 接受的偏差:两条 nit 不改,即 baseFlags 或别名声明的 yes,以及只认 .ts 的过滤(L1-a 已接受)。L1 ACCEPT 7228892060,契约审核首轮 7228083567,增量 7228877674。
  5. 范围外去向:N2 是 cli.mdx 里三条 --yes 选项说明,开了 docs(cli): the --yes option lines of os db orphans, os secret orphans and os secret rewrap don't say that a non-terminal run without --yes writes nothing and exits 1 #38052(p3,Blocked-by cli: os secret rewrap --apply in a non-interactive shell without --yes prints "Aborted" and exits 0 — the confirmation family (migrate, orphans --delete) exits 1 #36679)。
  6. 落地条款:Tier H ⇒ 由维护者亲手合并;或由 GOVERNED_APPROVERS(os-zhuang)批准后,本席按落地前检查落地。

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

维护者速读

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants